//流程模块【jieguolist.采购结果审批】下录入页面自定义js页面,初始函数
function initbodys(){
	loadProjectList();
}

function loadProjectList(){
    js.ajax(js.getajaxurl('getNowZhongBiaoProject','index','cg')
        ,{},function(s){
            var content = "<option value=''>-请选择-</option>";
            var obj = $("select[name='name']");
            $.each(s, function(i, field){
                content += "<option value='"+field.id+"'  data-id='"+field.projectid+"'>"+field.name+"</option>";
            });
            if (obj.length>0) {
                obj.html(content);
            }
        },'get,json',false,'');
}

function oninputblur(na, zb, obj){
    var projectid = obj.value;
    if (na == 'name') {
        js.ajax(js.getajaxurl('getNowYearMergeProjectInfo','index','cg'),
            {
                "id":projectid
            }, function(s){
                var data = s;
                if(data.budget) {
                    $("input[name='budget']").val(data.budget);
                }
                if(data.symbol) {
                    $("input[name='beian_num']").val(data.symbol);
                }
                if(data.proclamationdate) {
                    $("input[name='zbmoney']").val(data.zbmoney);
                }
                if(data.zbcompany) {
                    $("input[name='zbcompany']").val(data.zbcompany);
                }
                if(data.startbiddate) {
                    $("input[name='zbtime']").val(data.startbiddate);
                }
                if(data.buymode) {
                    $("input[name='caigoutype']").val(data.buymode);
                }
                if(data.companyname) {
                    $("input[name='projectcompany']").val(data.companyname);
                }
                if(data.proxygov) {
                    $("input[name='dljgname']").val(data.proxygov);
                }
                if(data.wbtime) {
                    $("input[name='wbtime']").val(data.wbtime);
                }
                if(data.zbcompany) {
                    $("input[name='zbcompany']").val(data.zbcompany);
                }
                if(data.zbmoney) {
                    $("input[name='zbmoney']").val(data.zbmoney);
                }
            },'get,json',false,'');
    }
}

function changesubmit(d) {
    var dljglink = regExp.filter('代理机构项目负责人', d.dljglink, 'name');
    if(dljglink.bool == false) return dljglink.msg;
    var dljglinktel = regExp.filter('代理机构项目负责人电话', d.dljglinktel, 'telOrMobile');
    if(dljglinktel.bool == false) return dljglinktel.msg;
    var zbcompany = regExp.filter('中标单位', d.zbcompany, 'chsAlpha');
    if(zbcompany.bool == false) return zbcompany.msg;
}